package com.jxjk.reportwork.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.jxjk.reportwork.exceldo.ReportPlanInExcelDO;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;

import java.util.List;

/**
 * 2024.9.13: 解析报工计划excel表格
 */
@Data
@Slf4j
public class ReportPlanListener extends AnalysisEventListener<ReportPlanInExcelDO> {
    private List<ReportPlanInExcelDO> reportPlanInExcelDOList = Lists.newArrayList();

    @Override
    public void invoke(ReportPlanInExcelDO reportPlanInExcelDO, AnalysisContext analysisContext) {
//        log.info("报工计划:{}", reportPlanInExcelDO);
        this.reportPlanInExcelDOList.add(reportPlanInExcelDO);
    }


    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {
        log.info("[报工计划]数据读取完成");
    }
}
